/********************************************************************
FileName    :   Dal_dpxstz.cs
CreateTime  :   2015-10-15 10:10
BaseClass   :   Dal_dpxstz
FileType    :   .cs
Author      :  minjie
Description :   Dal_dpxstzDAL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace OS.DAL
{
	/// <summary>
	/// Dal_dpxstz的摘要说明。
	/// </summary>
	public partial class Dal_dpxstz 
  	{ 
     		      
  		public bool Exists(string bmh) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) from dpxstz"); 
  			strSql.Append(" where "); 
           SqlParameter[] parameters = { new SqlParameter("@bmh", SqlDbType.Int,4)};  
  			return DbHelperSQL.Exists(strSql.ToString(),parameters); 
  		} 
  		 
  				 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  bool  Add(dpxstz_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into dpxstz(");			 
  	strSql.Append("rq,sj,bmh,spbh,lsj,jj,xssl,cxsje,xszk,xscb,xsml,sswr,xj,ysk,pfsbh,czy,bj,pzh,xh,jhrq,ysh,yhh,xjzp,csbj,wm_cpbh,hth,yfkye,jzbj,mem,hkje,bjd_pzh) values ("); 
  	strSql.Append("	@rq,@sj,@bmh,@spbh,@lsj,@jj,@xssl,@cxsje,@xszk,@xscb,@xsml,@sswr,@xj,@ysk,@pfsbh,@czy,@bj,@pzh,@xh,@jhrq,@ysh,@yhh,@xjzp,@csbj,@wm_cpbh,@hth,@yfkye,@jzbj,@mem,@hkje,@bjd_pzh	 ) "); 
  			SqlParameter[] parameters = { 
              new SqlParameter("@rq", SqlDbType.DateTime) ,              
              new SqlParameter("@sj", SqlDbType.DateTime) ,              
              new SqlParameter("@bmh", SqlDbType.Char,10) ,              
              new SqlParameter("@spbh", SqlDbType.Char,10) ,              
              new SqlParameter("@lsj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xssl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@cxsje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xszk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xscb", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xsml", SqlDbType.Decimal,9) ,              
              new SqlParameter("@sswr", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ysk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pfsbh", SqlDbType.Char,10) ,              
              new SqlParameter("@czy", SqlDbType.Char,10) ,              
              new SqlParameter("@bj", SqlDbType.Int,4) ,              
              new SqlParameter("@pzh", SqlDbType.Char,10) ,              
              new SqlParameter("@xh", SqlDbType.Int,4) ,              
              new SqlParameter("@jhrq", SqlDbType.DateTime) ,              
              new SqlParameter("@ysh", SqlDbType.Char,10) ,              
              new SqlParameter("@yhh", SqlDbType.Char,10) ,              
              new SqlParameter("@xjzp", SqlDbType.Char,10) ,              
              new SqlParameter("@csbj", SqlDbType.Int,4) ,              
              new SqlParameter("@wm_cpbh", SqlDbType.Char,10) ,              
              new SqlParameter("@hth", SqlDbType.Char,10) ,              
              new SqlParameter("@yfkye", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jzbj", SqlDbType.Int,4) ,              
              new SqlParameter("@mem", SqlDbType.Char,10) ,              
              new SqlParameter("@hkje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@bjd_pzh", SqlDbType.Char,10)};             
           if (model.rq != null)  
              parameters[0].Value = model.rq;  
           else  
              parameters[0].Value = DBNull.Value;  
              
           if (model.sj != null)  
              parameters[1].Value = model.sj;  
           else  
              parameters[1].Value = DBNull.Value;  
              
           if (model.bmh != null)  
              parameters[2].Value = model.bmh;  
           else  
              parameters[2].Value = DBNull.Value;  
              
           if (model.spbh != null)  
              parameters[3].Value = model.spbh;  
           else  
              parameters[3].Value = DBNull.Value;  
              
           if (model.lsj != null)  
              parameters[4].Value = model.lsj;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.jj != null)  
              parameters[5].Value = model.jj;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.xssl != null)  
              parameters[6].Value = model.xssl;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.cxsje != null)  
              parameters[7].Value = model.cxsje;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.xszk != null)  
              parameters[8].Value = model.xszk;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.xscb != null)  
              parameters[9].Value = model.xscb;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.xsml != null)  
              parameters[10].Value = model.xsml;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.sswr != null)  
              parameters[11].Value = model.sswr;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.xj != null)  
              parameters[12].Value = model.xj;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.ysk != null)  
              parameters[13].Value = model.ysk;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.pfsbh != null)  
              parameters[14].Value = model.pfsbh;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.czy != null)  
              parameters[15].Value = model.czy;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.bj != null)  
              parameters[16].Value = model.bj;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.pzh != null)  
              parameters[17].Value = model.pzh;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.xh != null)  
              parameters[18].Value = model.xh;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.jhrq != null)  
              parameters[19].Value = model.jhrq;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.ysh != null)  
              parameters[20].Value = model.ysh;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.yhh != null)  
              parameters[21].Value = model.yhh;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.xjzp != null)  
              parameters[22].Value = model.xjzp;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.csbj != null)  
              parameters[23].Value = model.csbj;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.wm_cpbh != null)  
              parameters[24].Value = model.wm_cpbh;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.hth != null)  
              parameters[25].Value = model.hth;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.yfkye != null)  
              parameters[26].Value = model.yfkye;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.jzbj != null)  
              parameters[27].Value = model.jzbj;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.mem != null)  
              parameters[28].Value = model.mem;  
           else  
              parameters[28].Value = DBNull.Value;  
              
           if (model.hkje != null)  
              parameters[29].Value = model.hkje;  
           else  
              parameters[29].Value = DBNull.Value;  
              
           if (model.bjd_pzh != null)  
              parameters[30].Value = model.bjd_pzh;  
           else  
              parameters[30].Value = DBNull.Value;  
              
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);			 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
              return false;; 
           }  
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据(字符串) 
  		/// </summary> 
  		public  string  AddStr(dpxstz_Entity model) 
  		{ 
  				if(model.bmh==null) 
  				{ 
  					model.bmh="";  
  				} 
  				if(model.spbh==null) 
  				{ 
  					model.spbh="";  
  				} 
  				if(model.lsj==null) 
  				{ 
  					model.lsj=0; 
  				} 
  				if(model.jj==null) 
  				{ 
  					model.jj=0; 
  				} 
  				if(model.xssl==null) 
  				{ 
  					model.xssl=0; 
  				} 
  				if(model.cxsje==null) 
  				{ 
  					model.cxsje=0; 
  				} 
  				if(model.xszk==null) 
  				{ 
  					model.xszk=0; 
  				} 
  				if(model.xscb==null) 
  				{ 
  					model.xscb=0; 
  				} 
  				if(model.xsml==null) 
  				{ 
  					model.xsml=0; 
  				} 
  				if(model.sswr==null) 
  				{ 
  					model.sswr=0; 
  				} 
  				if(model.xj==null) 
  				{ 
  					model.xj=0; 
  				} 
  				if(model.ysk==null) 
  				{ 
  					model.ysk=0; 
  				} 
  				if(model.pfsbh==null) 
  				{ 
  					model.pfsbh="";  
  				} 
  				if(model.czy==null) 
  				{ 
  					model.czy="";  
  				} 
  				if(model.bj==null) 
  				{ 
  					model.bj=0; 
  				} 
  				if(model.pzh==null) 
  				{ 
  					model.pzh="";  
  				} 
  				if(model.xh==null) 
  				{ 
  					model.xh=0; 
  				} 
  				if(model.ysh==null) 
  				{ 
  					model.ysh="";  
  				} 
  				if(model.yhh==null) 
  				{ 
  					model.yhh="";  
  				} 
  				if(model.xjzp==null) 
  				{ 
  					model.xjzp="";  
  				} 
  				if(model.csbj==null) 
  				{ 
  					model.csbj=0; 
  				} 
  				if(model.wm_cpbh==null) 
  				{ 
  					model.wm_cpbh="";  
  				} 
  				if(model.hth==null) 
  				{ 
  					model.hth="";  
  				} 
  				if(model.yfkye==null) 
  				{ 
  					model.yfkye=0; 
  				} 
  				if(model.jzbj==null) 
  				{ 
  					model.jzbj=0; 
  				} 
  				if(model.mem==null) 
  				{ 
  					model.mem="";  
  				} 
  				if(model.hkje==null) 
  				{ 
  					model.hkje=0; 
  				} 
  				if(model.bjd_pzh==null) 
  				{ 
  					model.bjd_pzh="";  
  				} 
  		 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into dpxstz(");			 
  	strSql.Append("rq,sj,bmh,spbh,lsj,jj,xssl,cxsje,xszk,xscb,xsml,sswr,xj,ysk,pfsbh,czy,bj,pzh,xh,jhrq,ysh,yhh,xjzp,csbj,wm_cpbh,hth,yfkye,jzbj,mem,hkje,bjd_pzh) values ("); 
  	strSql.Append("	'"+ model.rq+"','"+ model.sj+"','"+ model.bmh+"','"+ model.spbh+"',"+ model.lsj+","+ model.jj+","+ model.xssl+","+ model.cxsje+","+ model.xszk+","+ model.xscb+","+ model.xsml+","+ model.sswr+","+ model.xj+","+ model.ysk+",'"+ model.pfsbh+"','"+ model.czy+"',"+ model.bj+",'"+ model.pzh+"',"+ model.xh+",'"+ model.jhrq+"','"+ model.ysh+"','"+ model.yhh+"','"+ model.xjzp+"',"+ model.csbj+",'"+ model.wm_cpbh+"','"+ model.hth+"',"+ model.yfkye+","+ model.jzbj+",'"+ model.mem+"',"+ model.hkje+",'" +model.bjd_pzh+"'	 ) "); 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(dpxstz_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update dpxstz set "); 
              strSql.Append(" rq = @rq,"); 
              strSql.Append(" sj = @sj,"); 
              strSql.Append(" bmh = @bmh,"); 
              strSql.Append(" spbh = @spbh,"); 
              strSql.Append(" lsj = @lsj,"); 
              strSql.Append(" jj = @jj,"); 
              strSql.Append(" xssl = @xssl,"); 
              strSql.Append(" cxsje = @cxsje,"); 
              strSql.Append(" xszk = @xszk,"); 
              strSql.Append(" xscb = @xscb,"); 
              strSql.Append(" xsml = @xsml,"); 
              strSql.Append(" sswr = @sswr,"); 
              strSql.Append(" xj = @xj,"); 
              strSql.Append(" ysk = @ysk,"); 
              strSql.Append(" pfsbh = @pfsbh,"); 
              strSql.Append(" czy = @czy,"); 
              strSql.Append(" bj = @bj,"); 
              strSql.Append(" pzh = @pzh,"); 
              strSql.Append(" xh = @xh,"); 
              strSql.Append(" jhrq = @jhrq,"); 
              strSql.Append(" ysh = @ysh,"); 
              strSql.Append(" yhh = @yhh,"); 
              strSql.Append(" xjzp = @xjzp,"); 
              strSql.Append(" csbj = @csbj,"); 
              strSql.Append(" wm_cpbh = @wm_cpbh,"); 
              strSql.Append(" hth = @hth,"); 
              strSql.Append(" yfkye = @yfkye,"); 
              strSql.Append(" jzbj = @jzbj,"); 
              strSql.Append(" mem = @mem,"); 
              strSql.Append(" hkje = @hkje,"); 
              strSql.Append(" bjd_pzh = @bjd_pzh"); 
  			strSql.Append(" where  bmh=@bmh "); 
  						 
  SqlParameter[] parameters = { 
              new SqlParameter("@rq", SqlDbType.DateTime) ,              
              new SqlParameter("@sj", SqlDbType.DateTime) ,              
              new SqlParameter("@bmh", SqlDbType.Char,10) ,              
              new SqlParameter("@spbh", SqlDbType.Char,10) ,              
              new SqlParameter("@lsj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xssl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@cxsje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xszk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xscb", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xsml", SqlDbType.Decimal,9) ,              
              new SqlParameter("@sswr", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ysk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pfsbh", SqlDbType.Char,10) ,              
              new SqlParameter("@czy", SqlDbType.Char,10) ,              
              new SqlParameter("@bj", SqlDbType.Int,4) ,              
              new SqlParameter("@pzh", SqlDbType.Char,10) ,              
              new SqlParameter("@xh", SqlDbType.Int,4) ,              
              new SqlParameter("@jhrq", SqlDbType.DateTime) ,              
              new SqlParameter("@ysh", SqlDbType.Char,10) ,              
              new SqlParameter("@yhh", SqlDbType.Char,10) ,              
              new SqlParameter("@xjzp", SqlDbType.Char,10) ,              
              new SqlParameter("@csbj", SqlDbType.Int,4) ,              
              new SqlParameter("@wm_cpbh", SqlDbType.Char,10) ,              
              new SqlParameter("@hth", SqlDbType.Char,10) ,              
              new SqlParameter("@yfkye", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jzbj", SqlDbType.Int,4) ,              
              new SqlParameter("@mem", SqlDbType.Char,10) ,              
              new SqlParameter("@hkje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@bjd_pzh", SqlDbType.Char,10)};             
           if (model.rq != null)  
              parameters[0].Value = model.rq;  
           else  
              parameters[0].Value = DBNull.Value;  
              
           if (model.sj != null)  
              parameters[1].Value = model.sj;  
           else  
              parameters[1].Value = DBNull.Value;  
              
           if (model.bmh != null)  
              parameters[2].Value = model.bmh;  
           else  
              parameters[2].Value = DBNull.Value;  
              
           if (model.spbh != null)  
              parameters[3].Value = model.spbh;  
           else  
              parameters[3].Value = DBNull.Value;  
              
           if (model.lsj != null)  
              parameters[4].Value = model.lsj;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.jj != null)  
              parameters[5].Value = model.jj;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.xssl != null)  
              parameters[6].Value = model.xssl;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.cxsje != null)  
              parameters[7].Value = model.cxsje;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.xszk != null)  
              parameters[8].Value = model.xszk;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.xscb != null)  
              parameters[9].Value = model.xscb;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.xsml != null)  
              parameters[10].Value = model.xsml;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.sswr != null)  
              parameters[11].Value = model.sswr;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.xj != null)  
              parameters[12].Value = model.xj;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.ysk != null)  
              parameters[13].Value = model.ysk;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.pfsbh != null)  
              parameters[14].Value = model.pfsbh;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.czy != null)  
              parameters[15].Value = model.czy;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.bj != null)  
              parameters[16].Value = model.bj;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.pzh != null)  
              parameters[17].Value = model.pzh;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.xh != null)  
              parameters[18].Value = model.xh;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.jhrq != null)  
              parameters[19].Value = model.jhrq;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.ysh != null)  
              parameters[20].Value = model.ysh;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.yhh != null)  
              parameters[21].Value = model.yhh;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.xjzp != null)  
              parameters[22].Value = model.xjzp;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.csbj != null)  
              parameters[23].Value = model.csbj;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.wm_cpbh != null)  
              parameters[24].Value = model.wm_cpbh;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.hth != null)  
              parameters[25].Value = model.hth;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.yfkye != null)  
              parameters[26].Value = model.yfkye;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.jzbj != null)  
              parameters[27].Value = model.jzbj;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.mem != null)  
              parameters[28].Value = model.mem;  
           else  
              parameters[28].Value = DBNull.Value;  
              
           if (model.hkje != null)  
              parameters[29].Value = model.hkje;  
           else  
              parameters[29].Value = DBNull.Value;  
              
           if (model.bjd_pzh != null)  
              parameters[30].Value = model.bjd_pzh;  
           else  
              parameters[30].Value = DBNull.Value;  
              
              int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(string  bmh) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from dpxstz "); 
  			strSql.Append(" where  bmh=@bmh"); 
  			SqlParameter[] parameters = {  new SqlParameter("@bmh", SqlDbType.Char,10) };  
    parameters[0].Value = bmh;  
   
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string bmhlist ) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from dpxstz "); 
  			strSql.Append(" where ID in ("+bmhlist + ")  "); 
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public dpxstz_Entity GetModel(string   bmh) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select  rq,sj,bmh,spbh,lsj,jj,xssl,cxsje,xszk,xscb,xsml,sswr,xj,ysk,pfsbh,czy,bj,pzh,xh,jhrq,ysh,yhh,xjzp,csbj,wm_cpbh,hth,yfkye,jzbj,mem,hkje,bjd_pzh");	
		strSql.Append("  from dpxstz"); 
  			strSql.Append(" where  bmh=@bmh "); 
  			SqlParameter[] parameters = {  new SqlParameter("@bmh", SqlDbType.Char,10) };  
    parameters[0].Value = bmh;  
  			 
  			dpxstz_Entity model=new dpxstz_Entity(); 
  			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); 
  			 
  			if(ds!=null&&ds.Tables[0].Rows.Count>0) 
  			{ 
  		DataTable dt=ds.Tables[0];	  
  				if(dt.Rows[0]["rq"]!=null&&dt.Rows[0]["rq"].ToString()!="") 
  				{ 
  					model.rq=DateTime.Parse(dt.Rows[0]["rq"].ToString()); 
  				} 
  				if(dt.Rows[0]["sj"]!=null&&dt.Rows[0]["sj"].ToString()!="") 
  				{ 
  					model.sj=DateTime.Parse(dt.Rows[0]["sj"].ToString()); 
  				} 
  				model.bmh= dt.Rows[0]["bmh"].ToString(); 
  				model.spbh= dt.Rows[0]["spbh"].ToString(); 
  				if(dt.Rows[0]["lsj"]!=null&&dt.Rows[0]["lsj"].ToString()!="") 
  				{ 
  					model.lsj=decimal.Parse(dt.Rows[0]["lsj"].ToString()); 
  				} 
  				if(dt.Rows[0]["jj"]!=null&&dt.Rows[0]["jj"].ToString()!="") 
  				{ 
  					model.jj=decimal.Parse(dt.Rows[0]["jj"].ToString()); 
  				} 
  				if(dt.Rows[0]["xssl"]!=null&&dt.Rows[0]["xssl"].ToString()!="") 
  				{ 
  					model.xssl=decimal.Parse(dt.Rows[0]["xssl"].ToString()); 
  				} 
  				if(dt.Rows[0]["cxsje"]!=null&&dt.Rows[0]["cxsje"].ToString()!="") 
  				{ 
  					model.cxsje=decimal.Parse(dt.Rows[0]["cxsje"].ToString()); 
  				} 
  				if(dt.Rows[0]["xszk"]!=null&&dt.Rows[0]["xszk"].ToString()!="") 
  				{ 
  					model.xszk=decimal.Parse(dt.Rows[0]["xszk"].ToString()); 
  				} 
  				if(dt.Rows[0]["xscb"]!=null&&dt.Rows[0]["xscb"].ToString()!="") 
  				{ 
  					model.xscb=decimal.Parse(dt.Rows[0]["xscb"].ToString()); 
  				} 
  				if(dt.Rows[0]["xsml"]!=null&&dt.Rows[0]["xsml"].ToString()!="") 
  				{ 
  					model.xsml=decimal.Parse(dt.Rows[0]["xsml"].ToString()); 
  				} 
  				if(dt.Rows[0]["sswr"]!=null&&dt.Rows[0]["sswr"].ToString()!="") 
  				{ 
  					model.sswr=decimal.Parse(dt.Rows[0]["sswr"].ToString()); 
  				} 
  				if(dt.Rows[0]["xj"]!=null&&dt.Rows[0]["xj"].ToString()!="") 
  				{ 
  					model.xj=decimal.Parse(dt.Rows[0]["xj"].ToString()); 
  				} 
  				if(dt.Rows[0]["ysk"]!=null&&dt.Rows[0]["ysk"].ToString()!="") 
  				{ 
  					model.ysk=decimal.Parse(dt.Rows[0]["ysk"].ToString()); 
  				} 
  				model.pfsbh= dt.Rows[0]["pfsbh"].ToString(); 
  				model.czy= dt.Rows[0]["czy"].ToString(); 
  				if(dt.Rows[0]["bj"]!=null&&dt.Rows[0]["bj"].ToString()!="") 
  				{ 
  					model.bj=int.Parse(dt.Rows[0]["bj"].ToString()); 
  				} 
  				model.pzh= dt.Rows[0]["pzh"].ToString(); 
  				if(dt.Rows[0]["xh"]!=null&&dt.Rows[0]["xh"].ToString()!="") 
  				{ 
  					model.xh=int.Parse(dt.Rows[0]["xh"].ToString()); 
  				} 
  				if(dt.Rows[0]["jhrq"]!=null&&dt.Rows[0]["jhrq"].ToString()!="") 
  				{ 
  					model.jhrq=DateTime.Parse(dt.Rows[0]["jhrq"].ToString()); 
  				} 
  				model.ysh= dt.Rows[0]["ysh"].ToString(); 
  				model.yhh= dt.Rows[0]["yhh"].ToString(); 
  				model.xjzp= dt.Rows[0]["xjzp"].ToString(); 
  				if(dt.Rows[0]["csbj"]!=null&&dt.Rows[0]["csbj"].ToString()!="") 
  				{ 
  					model.csbj=int.Parse(dt.Rows[0]["csbj"].ToString()); 
  				} 
  				model.wm_cpbh= dt.Rows[0]["wm_cpbh"].ToString(); 
  				model.hth= dt.Rows[0]["hth"].ToString(); 
  				if(dt.Rows[0]["yfkye"]!=null&&dt.Rows[0]["yfkye"].ToString()!="") 
  				{ 
  					model.yfkye=decimal.Parse(dt.Rows[0]["yfkye"].ToString()); 
  				} 
  				if(dt.Rows[0]["jzbj"]!=null&&dt.Rows[0]["jzbj"].ToString()!="") 
  				{ 
  					model.jzbj=int.Parse(dt.Rows[0]["jzbj"].ToString()); 
  				} 
  				model.mem= dt.Rows[0]["mem"].ToString(); 
  				if(dt.Rows[0]["hkje"]!=null&&dt.Rows[0]["hkje"].ToString()!="") 
  				{ 
  					model.hkje=decimal.Parse(dt.Rows[0]["hkje"].ToString()); 
  				} 
  				model.bjd_pzh= dt.Rows[0]["bjd_pzh"].ToString(); 
  				return model; 
  			} 
  			else 
  			{ 
  				return null; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 分页获取数据列表 
  		/// </summary> 
  		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  		 strSql.Append("SELECT * FROM ( "); 
  		 strSql.Append(" SELECT ROW_NUMBER() OVER ("); 
  if (!string.IsNullOrEmpty(orderby.Trim())) 
 { 
    strSql.Append("order by T." + orderby); 
 } 
else  
 { 
     strSql.Append("order by T.bmh desc"); 
 } 
		 strSql.Append(")AS Row, T.*  from dpxstz T "); 
  		 if (!string.IsNullOrEmpty(strWhere.Trim()))  
  			{ 
  			 strSql.Append(" WHERE " + strWhere); 
  			} 
  		    strSql.Append(" ) TT"); 
  	        strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select * "); 
  			strSql.Append(" FROM dpxstz "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select "); 
  			if(Top>0) 
  			{ 
  				strSql.Append(" top "+Top.ToString()); 
  			} 
  			strSql.Append(" * "); 
  			strSql.Append(" FROM dpxstz "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			strSql.Append(" order by " + filedOrder); 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得记录条数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) "); 
  			strSql.Append(" FROM dpxstz "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  		   object obj=	DbHelperSQL.GetSingle(strSql.ToString()); 
  			if(obj!=null && obj.ToString()!="") 
  			{ 
              	return Convert.ToInt32(obj); 
  			} 
  			else 
  			return 0; 
  		} 
   
      
  	} 
  
}
